$( document ).ready(function() {
    $('.pro-info div.image').each(function(){
        var frmHeight = $(this).height();
        var img = $(this).children('img');
        var imgHeigh = img.height();
        if(imgHeigh>0){
            if(imgHeigh > frmHeight){
                img.css('height',(frmHeight - 10));
            }else{
                var margin = (frmHeight - imgHeigh)/2;
                img.css('margin-top',(margin + 5));
            }
        }
    });
    
    $('div.slide-nav>a').click(function(){
    	var title_a = $(this).attr("title");
    	//add class for node a
    	$('div.slide-nav>a').removeClass("active");
    	$(this).addClass("active");
    	//add class for node div
    	$('div.item').removeClass("active");
    	$('div.item[title = '+title_a+']').addClass("active");
    });
    var max_a = $('#check').attr("title");
    var i = 1;
    setInterval(function() {
    	$('div.item').css("opacity","0");
    	$('div.slide-nav>a').removeClass("active");
    	$('div.item').removeClass("active");
    	$('a[title = '+i+']').addClass("active");
    	$('div.item[title = '+i+']').addClass("active").animate({
			opacity: 1
			}, 1500 );
    	if(i < max_a)
    		i++;
    	else
    		i = 1;
  }, 2500);
});